﻿using UnityEngine;
using System.Collections;

namespace Room
{
    public class RCAIGateDestroy : RCAIGateBase
    {
        protected override void OnEnter()
        {
            //controller.effectObjs[RCAIGate.NormalIndex].gameObject.SetActive(false);
            //ShowEffect(controller.effectObjs[RCAIGate.DestroyIndex]);
            //ShowEffect(controller.effectObjs[RCAIGate.DestroyMeshIndex]);
            //if (controller.sceneObj != null)
            //{
            //    controller.sceneObj.SetActive(false);
            //}
            //controller.SetEnableObstacle(false);

            DestroyTransfers(controller.Camp);
        }

        void DestroyTransfers(int camp)
        {
            var transfers = Dict.Blo.DictUnionFightTransferBlo.GetAll();
            foreach (var transfer in transfers)
            {
                if (transfer.Camp == camp && controller.owner.charactorManager.GetCharactor(transfer.UFTransferId) != null)
                {
                    controller.owner.charactorManager.DestroyCharactor(transfer.UFTransferId);
                }
            }
        }

        protected override void OnEnter(object param)
        {
            //if (controller.effectObjs != null && controller.effectObjs.Length > 0)
            //{
            //    controller.effectObjs[RCAIGate.NormalIndex].gameObject.SetActive(false);
            //}
            //if(controller.sceneObj!=null)
            //{
            //    controller.sceneObj.SetActive(false);
            //}
            //controller.SetEnableObstacle(false);
        }

        protected override void OnTick()
        {
            base.OnTick();
        }

        protected override void OnLeave()
        {
            base.OnLeave();

        }
    }
}